import { defHttp } from '/@/utils/request'

export function getUserListApi() {
  return defHttp.get<BaseResponseWithArray<defs.common.User>>({
    url: '/api/user',
  })
}

export function addUserApi(data: Partial<defs.common.CreateUserRequest>) {
  return defHttp.post<defs.common.User>({
    url: '/api/user',
    data,
  })
}

export function updateUserApi(id: string | number, data: Partial<defs.common.UpdateUserRequest>) {
  return defHttp.put<number[]>({
    url: `/api/user/${id}`,
    data,
  })
}

export function deleteUserApi(id: string) {
  return defHttp.delete<number>({
    url: `/api/user/${id}`,
  })
}
